<%@ page language="java" import="java.util.*" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Structures</title>
</head>
<body>
	<%
	Integer resQuantity = null;
	if(session.getAttribute("Resources")!=null){
		resQuantity = (Integer)session.getAttribute("Resources");
	}
	%>
	<div style="width: 100%;text-align:center;">
		Resources: <%=resQuantity%>
	</div>
	<div style="width: 300px;height: 100%; float: left">
		<a href="Overview" style="width: 300px;float: left">Overview</a>
		<a href="Structures" style="width: 300px;float: left">Structures</a>
		<a href="Research" style="width: 300px;float: left">Research</a>
		<a href="Barracks" style="width: 300px;float: left">Barracks</a>
		<a href="Island" style="width: 300px;float: left">Island</a>
		<a href="Movement" style="width: 300px;float: left">Movement Report</a>
		<a href="Messages" style="width: 300px;float: left">Messages</a>
	</div>
	
	<table border="1" cellspacing="0">
		<tr>
			<th>Name</th>
			<th>Cost</th>
			<th>Income</th>
			<th>Level</th>
		</tr>
	<% 
	
	ArrayList<Integer> STRUCT_ID = (ArrayList<Integer>) request.getAttribute("STRUCT_ID");
	ArrayList<String> NAME = (ArrayList<String>) request.getAttribute("NAME");
	ArrayList<Double> COST = (ArrayList<Double>) request.getAttribute("COST");
	ArrayList<Double> INCOME = (ArrayList<Double>) request.getAttribute("INCOME");
	ArrayList<Integer> LEVEL = (ArrayList<Integer>) request.getAttribute("LEVEL");
	Iterator<Integer> iter = STRUCT_ID.iterator();
	while(iter.hasNext()){
		Integer ID = iter.next();
		int index = STRUCT_ID.indexOf(ID);

		%>
		<tr>
			<td><%=NAME.get(index)%></td>
			<td><%=COST.get(index).intValue()%></td>
			<td><%=INCOME.get(index)%></td>
			<td><%=LEVEL.get(index)%></td>
			<td>
				<form action="Structures" method="post">
					<input type="hidden" name="SID" value="<%=STRUCT_ID.get(index)%>"></input>
					<input type="submit" title="Level Up"></input>
				</form>
			</td>
		</tr>
		
		
		<%
		out.print("</div>");
	}
	%>
	</div>
</body>
</html>